<?php

/**
 * @category    H2
 * @package     
 * @subpackage  
 * @author      Nam Nguyen
 * @copyright   
 */
class Response {

  private static $_instance;

  public static function getInstance() {
    if (self::$_instance == NULL) {
      self::$_instance = new self();
    }
    return self::$_instance;
  }

  public static function redirect($uri) {
    header('location: ' . $uri);
  }

  /**
   */
  public function sendHeaders() {
    return $this;
  }

  /**
   */
  public static function sendBody() {
    if (($con = Controller::current()) != NULL) {
      $con->render();
    }
  }

  public function sendLayout($name = NULL) {
    $layout_path = LAYOUT_DIR . 'default' . DIRECTORY_SEPARATOR . 'admin' . DIRECTORY_SEPARATOR . 'index.tpl';
    include_once $layout_path;
  }

}